{% extends "base_markets.html" %}

{% block object-tools %}
    <ul class="object-tools">
        <li><a href="/portadmin/markets/" class="historylink">Markets list</a></li>
    </ul>
{% endblock %}

{% block mainheading %}{{ block.super }} \ Add market{% endblock %}

{% block content %}

    <form action="" method="post">
    {% csrf_token %}
    <table>
        {# form.as_table #}
        {% for f in form %}
            <tr>
                <th>{{ f.label }}</th>
                <td>
                    {{ f.errors }}
                    {% if f.name == "start" or f.name == "end" %}
                        <select name="{{ f.name }}">
                            {% for h in hours %}
                                {% for m in minutes %}
                                    <option value="{{ h|stringformat:"02d" }}:{{ m|stringformat:"02d" }}">{{ h|stringformat:"02d" }}:{{ m|stringformat:"02d" }}</option>
                                {% endfor %}
                            {% endfor %}
                        </select>
                    {% else %}
                        {{ f }}
                    {% endif %}
                </td>
        {% endfor %}
    </table>
    <input type="submit" class="default" value="Save" />
    <input type="button" onclick="document.location.href='/portadmin/markets/'; return false;" value="Markets list" />
    </form>

{% endblock %}
